package com.crm.model.pojo;

import java.io.Serializable;
import javax.persistence.*;

import com.fasterxml.jackson.annotation.JsonIgnore;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;


/**
 * The persistent class for the contacts database table.
 * 
 */
@Entity
@Table(name="contacts")
@NamedQuery(name="Contact.findAll", query="SELECT c FROM Contact c")
public class Contact implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(name="con_id")
	private Integer conId;//联系人id
	
	@Column(name="cust_id")
	private Integer custId;//客户id

	@Column(name="annual_income")
	private Integer annualIncome;//年收入

	private String appellation;//称谓

	private String code;//邮编

	@Column(name="con_catalogue")
	private Integer conCatalogue;//联系人分类

	@Column(name="con_character")
	private Integer conCharacter;//性格

	@Column(name="con_name")
	private String conName;//联系人名称

	@Column(name="consumption_habit")
	private Integer consumptionHabit;//消费习惯

	private Integer counterpart;//所有者

	@Column(name="cust_address")
	private String custAddress;//地址

	@Column(name="cust_email")
	private String custEmail;//邮箱

	@Column(name="cust_sex")
	private Integer custSex;//性别

	@Column(name="cust_tel")
	private String custTel;//电话

	@Column(name="document_num")
	private String documentNum;//证件号码

	@Column(name="document_type")
	private Integer documentType;//证件类型

	private Integer habit;//习惯

	private Integer interest;//兴趣爱好

	@Temporal(TemporalType.DATE)
	@Column(name="mer_day")
	private Date merDay;//纪念日
	
	private String mtype;//纪念日类型

	private String operations;//负责业务

	@Column(name="person_size")
	private Integer personSize;//人员规模

	private String photo;//照片

	private String remarks;//备注

	@Column(name="social_character")
	private Integer socialCharacter;//社交特点

	private String url;//网址

	private Integer status;//状态
	//bi-directional many-to-one association to Customer
	@JsonIgnore
	@OneToMany(mappedBy="contact")
	private List<Customer> customers;

	//bi-directional many-to-one association to Repairorder
	@JsonIgnore
	@OneToMany(mappedBy="contact")
	private List<Repairorder> repairorders;

	//bi-directional many-to-one association to SalesOpportunity
	@JsonIgnore
	@OneToMany(mappedBy="contact")
	private List<SalesOpportunity> salesOpportunities;

	public Contact() {
	}	

	@Override
	public String toString() {
		return "Contact [conId=" + conId + ", custId=" + custId + ", annualIncome=" + annualIncome + ", appellation="
				+ appellation + ", code=" + code + ", conCatalogue=" + conCatalogue + ", conCharacter=" + conCharacter
				+ ", conName=" + conName + ", consumptionHabit=" + consumptionHabit + ", counterpart=" + counterpart
				+ ", custAddress=" + custAddress + ", custEmail=" + custEmail + ", custSex=" + custSex + ", custTel="
				+ custTel + ", documentNum=" + documentNum + ", documentType=" + documentType + ", habit=" + habit
				+ ", interest=" + interest + ", merDay=" + merDay + ", mtype=" + mtype + ", operations=" + operations
				+ ", personSize=" + personSize + ", photo=" + photo + ", remarks=" + remarks + ", socialCharacter="
				+ socialCharacter + ", url=" + url + ", status=" + status + "]";
	}

	public Contact(Integer conId, Integer custId, Integer annualIncome, String appellation, String code,
			Integer conCatalogue, Integer conCharacter, String conName, Integer consumptionHabit, Integer counterpart,
			String custAddress, String custEmail, Integer custSex, String custTel, String documentNum,
			Integer documentType, Integer habit, Integer interest, Date merDay, String mtype, String operations,
			Integer personSize, String photo, String remarks, Integer socialCharacter, String url, Integer status) {
		super();
		this.conId = conId;
		this.custId = custId;
		this.annualIncome = annualIncome;
		this.appellation = appellation;
		this.code = code;
		this.conCatalogue = conCatalogue;
		this.conCharacter = conCharacter;
		this.conName = conName;
		this.consumptionHabit = consumptionHabit;
		this.counterpart = counterpart;
		this.custAddress = custAddress;
		this.custEmail = custEmail;
		this.custSex = custSex;
		this.custTel = custTel;
		this.documentNum = documentNum;
		this.documentType = documentType;
		this.habit = habit;
		this.interest = interest;
		this.merDay = merDay;
		this.mtype = mtype;
		this.operations = operations;
		this.personSize = personSize;
		this.photo = photo;
		this.remarks = remarks;
		this.socialCharacter = socialCharacter;
		this.url = url;
		this.status = status;
	}

	public String getMtype() {
		return mtype;
	}

	public void setMtype(String mtype) {
		this.mtype = mtype;
	}

	public Integer getConId() {
		return this.conId;
	}

	public Integer getCustId() {
		return custId;
	}

	public void setCustId(Integer custId) {
		this.custId = custId;
	}

	public void setConId(Integer conId) {
		this.conId = conId;
	}

	public Integer getAnnualIncome() {
		return this.annualIncome;
	}

	public void setAnnualIncome(Integer annualIncome) {
		this.annualIncome = annualIncome;
	}

	public String getAppellation() {
		return this.appellation;
	}

	public void setAppellation(String appellation) {
		this.appellation = appellation;
	}

	public String getCode() {
		return this.code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public Integer getConCatalogue() {
		return this.conCatalogue;
	}

	public void setConCatalogue(Integer conCatalogue) {
		this.conCatalogue = conCatalogue;
	}

	public Integer getConCharacter() {
		return this.conCharacter;
	}

	public void setConCharacter(Integer conCharacter) {
		this.conCharacter = conCharacter;
	}

	public String getConName() {
		return this.conName;
	}

	public void setConName(String conName) {
		this.conName = conName;
	}

	public Integer getConsumptionHabit() {
		return this.consumptionHabit;
	}

	public void setConsumptionHabit(Integer consumptionHabit) {
		this.consumptionHabit = consumptionHabit;
	}

	public Integer getCounterpart() {
		return this.counterpart;
	}

	public void setCounterpart(Integer counterpart) {
		this.counterpart = counterpart;
	}

	public String getCustAddress() {
		return this.custAddress;
	}

	public void setCustAddress(String custAddress) {
		this.custAddress = custAddress;
	}

	public String getCustEmail() {
		return this.custEmail;
	}

	public void setCustEmail(String custEmail) {
		this.custEmail = custEmail;
	}

	public Integer getCustSex() {
		return this.custSex;
	}

	public void setCustSex(Integer custSex) {
		this.custSex = custSex;
	}

	public String getCustTel() {
		return this.custTel;
	}

	public void setCustTel(String custTel) {
		this.custTel = custTel;
	}

	public String getDocumentNum() {
		return this.documentNum;
	}

	public void setDocumentNum(String documentNum) {
		this.documentNum = documentNum;
	}

	public Integer getDocumentType() {
		return this.documentType;
	}

	public void setDocumentType(Integer documentType) {
		this.documentType = documentType;
	}

	public Integer getHabit() {
		return this.habit;
	}

	public void setHabit(Integer habit) {
		this.habit = habit;
	}

	public Integer getInterest() {
		return this.interest;
	}

	public void setInterest(Integer interest) {
		this.interest = interest;
	}

	public Date getMerDay() {
		return this.merDay;
	}

	public void setMerDay(Date merDay) {
		this.merDay = merDay;
	}

	public String getOperations() {
		return this.operations;
	}

	public void setOperations(String operations) {
		this.operations = operations;
	}

	public Integer getPersonSize() {
		return this.personSize;
	}

	public void setPersonSize(Integer personSize) {
		this.personSize = personSize;
	}

	public String getPhoto() {
		return this.photo;
	}

	public void setPhoto(String photo) {
		this.photo = photo;
	}

	public String getRemarks() {
		return this.remarks;
	}

	public void setRemarks(String remarks) {
		this.remarks = remarks;
	}

	public Integer getSocialCharacter() {
		return this.socialCharacter;
	}

	public void setSocialCharacter(Integer socialCharacter) {
		this.socialCharacter = socialCharacter;
	}

	public String getUrl() {
		return this.url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public List<Customer> getCustomers() {
		return this.customers;
	}

	public void setCustomers(List<Customer> customers) {
		this.customers = customers;
	}

	public Customer addCustomer(Customer customer) {
		getCustomers().add(customer);
		customer.setContact(this);

		return customer;
	}

	public Customer removeCustomer(Customer customer) {
		getCustomers().remove(customer);
		customer.setContact(null);

		return customer;
	}

	public List<Repairorder> getRepairorders() {
		return this.repairorders;
	}

	public void setRepairorders(List<Repairorder> repairorders) {
		this.repairorders = repairorders;
	}

	public Repairorder addRepairorder(Repairorder repairorder) {
		getRepairorders().add(repairorder);
		repairorder.setContact(this);

		return repairorder;
	}

	public Repairorder removeRepairorder(Repairorder repairorder) {
		getRepairorders().remove(repairorder);
		repairorder.setContact(null);

		return repairorder;
	}

	public List<SalesOpportunity> getSalesOpportunities() {
		return this.salesOpportunities;
	}

	public void setSalesOpportunities(List<SalesOpportunity> salesOpportunities) {
		this.salesOpportunities = salesOpportunities;
	}

	public SalesOpportunity addSalesOpportunity(SalesOpportunity salesOpportunity) {
		getSalesOpportunities().add(salesOpportunity);
		salesOpportunity.setContact(this);

		return salesOpportunity;
	}

	public SalesOpportunity removeSalesOpportunity(SalesOpportunity salesOpportunity) {
		getSalesOpportunities().remove(salesOpportunity);
		salesOpportunity.setContact(null);

		return salesOpportunity;
	}

}